#include<iostream>
#include<string>
using namespace std;
string s1, s2;
int main()
{
	while (cin >> s1) {
		if (s1 == "#")break;
		cin >> s2;
		int cnt = 0;
		//cout << "idx==" << s1.find(s2) << endl;
		while (s1.find(s2) != -1) {
			s1 = s1.substr(s1.find(s2) + s2.size());
			cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}